export default {
    inject: ['reload'],
    methods: {
        onChangeLocale (command) {
            // this.$api.SYS_USER_INFO
            this.$i18n.locale = command
            let message = `${this.$t('public.notify.special.language.message')}：${this.$t('_name')} [ ${this.$i18n.locale} ]`
            /*if (process.env.VUE_APP_BUILD_MODE === 'PREVIEW') {
              message = [
                `当前语言：${this.$t('_name')} [ ${this.$i18n.locale} ]`,
                '仅提供切换功能，没有配置具体的语言数据 ',
                '文档参考：<a class="el-link el-link--primary is-underline" target="_blank" href="https://d2.pub/zh/doc/d2-admin/locales">《国际化 | D2Admin》</a>'
              ].join('<br/>')
            }*/
            this.$notify({
                title: `${this.$t('public.notify.special.language.title')}`,
                dangerouslyUseHTMLString: true,
                message
            })

            this.$api.SYS_USER_INFO({
                locale: command == 'en' ? 'en' : 'zh-CN'
            }).then(res => {
                // console.log(res)
                setTimeout(() => {
                    window.location.reload();
                    // this.reload();
                },500)
            })
        }
    }
}
